function [fitresult, gof] = power_fit(cumulative_distance, cumulative_tau, cumulative_pvalue)
%CREATEFITS(CUMULATIVE_DISTANCE,CUMULATIVE_TAU,CUMULATIVE_PVALUE)
%  Create fits.
%
%  Data for 'untitled fit 1' fit:
%      X Input : cumulative_distance
%      Y Output: cumulative_tau
%  Data for 'untitled fit 2' fit:
%      X Input : cumulative_distance
%      Y Output: cumulative_pvalue
%  Output:
%      fitresult : a cell-array of fit objects representing the fits.
%      gof : structure array with goodness-of fit info.
%
%  See also FIT, CFIT, SFIT.

%  Auto-generated by MATLAB on 09-Feb-2022 11:47:37

%% Initialization.

% Initialize arrays to store fits and goodness-of-fit.
fitresult = cell( 1, 1 );
gof = struct( 'sse', cell( 1, 1 ), ...
    'rsquare', [], 'dfe', [], 'adjrsquare', [], 'rmse', [] );

%% Fit: 'untitled fit 1'.
[xData, yData] = prepareCurveData( cumulative_distance, cumulative_tau );

% Set up fittype and options.
ft = fittype( 'power1' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.StartPoint = [0.549314165601359 -0.348516471348613 ];

% Fit model to data.
[fitresult{1}, gof(1)] = fit( xData, yData, ft, opts );

% Plot fit with data.
h = plot(fitresult{1},xData, yData);
grid on
ax = gca
ax.LineWidth = 4
h(2).LineWidth = 4
set(gca,'fontname','times');
set(gca,'Fontsize',40);
ax.FontSize = 40;
legend off
end

